﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Wpf.CommonTools.SystemExtension
{
    public class MyUrl
    {
        /// <summary>
        /// 获取页面名称
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static string GetPageName(string url)
        {
            int i = url.LastIndexOf("/");
            if (i != -1)
            {
                string webPage = url.Remove(0, i + 1); //这里获得web页面文件名和其后的get参数字符串 
                int j = webPage.LastIndexOf("?");
                if (j >= 0)
                {
                    webPage = webPage.Remove(j, webPage.Length - j);
                }
                return webPage;
            }
            else
            {
                return url;
            }
        }
    }
}
